/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.powerhua.xsys.workflow.dao.ibatis;

import com.powerhua.core.db.UUIDGenerator;
import com.powerhua.xsys.workflow.dao.IWorkflowDao;
import com.powerhua.xsys.workflow.domain.WorkflowDefinition;
import com.powerhua.xsys.workflow.domain.WorkflowForm;
import com.powerhua.xsys.workflow.domain.WorkflowFormContent;
import java.util.List;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

/**
 *
 * @author Brian.Xie
 */
public class WorkflowDao extends SqlMapClientDaoSupport implements IWorkflowDao {

    @Override
    public List getAllWorkflowDefs() {
        List list = getSqlMapClientTemplate().queryForList("queryForWorkflowDefs", null);
        return list;
    }

    @Override
    public int saveWorkflowDef(WorkflowDefinition workflowDef) {
        workflowDef.setId(UUIDGenerator.getUUID());
        getSqlMapClientTemplate().insert("insertWorkflowDef", workflowDef);
        return 0;
    }

    @Override
    public List getAllWorkflowForms() {
        List list = getSqlMapClientTemplate().queryForList("queryForWorkflowForms", null);
        return list;
    }

    @Override
    public int saveWorkflowForm(WorkflowForm workflowForm) {
        return 0;
    }

    @Override
    public int setWorkflowForm(String formId, WorkflowFormContent workflowFormContent) {
        return 0;
    }

}
